﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Southridge.Data;
using System.Windows;

namespace Southridge.View
{
    public interface IViewLogger
    {
        void LogError(string s);
        void LogMessage(string s);
        void LogAlert(string s);

    }

    public class MessageBoxViewLogger : IViewLogger
    {

        #region IViewLogger Members

        public void LogError(string s)
        {
            MessageBox.Show(s);
        }

        public void LogMessage(string s)
        {
            MessageBox.Show(s);
        }

        public void LogAlert(string s)
        {

            MessageBox.Show(s);
        }

        #endregion
    }

    public class ViewModelBase : BusinessEntity
    {
        protected IViewLogger _logger;

        public ViewModelBase()
        {
        }

        public ViewModelBase(IViewLogger logger)
        {
            if (logger != null)
            {
                _logger = logger;
            }
        }
        public void LogError(string s)
        {
            if (_logger != null)
                _logger.LogError(s);
        }

        public void LogMessage(string s)
        {
            if (_logger != null)
                _logger.LogMessage(s);
        }
    } 
    
}
